﻿using PlutoStudio.Dependency;
using PlutoStudio.Runtime.Remoting;
using System;
using System.Collections.Generic;
using System.Text;

namespace PlutoStudio.Runtime.Session
{
    /// <summary>
    /// Implements null object pattern for <see cref="IAbpSession"/>.
    /// </summary>
    public class NullSession : SessionBase
    {
        /// <summary>
        /// Singleton instance.
        /// </summary>
        public static NullSession Instance { get; } = new NullSession();

        /// <inheritdoc/>
        public override int? UserId => null;

        public override int? ImpersonatorUserId => null;

        private NullSession()
            : base(
                  new DataContextAmbientScopeProvider<SessionOverride>(new AsyncLocalAmbientDataContext())
            )
        {

        }
    }
}
